﻿using System;
using System.Collections.Generic;
using System.Text;
using GLImp;
using System.Drawing;
using OpenTK;
using CastleOfTheDisillusioned.Location;
using CastleOfTheDisillusioned.Location.Maps;
using CastleOfTheDisillusioned.Overworld;

namespace CastleOfTheDisillusioned.Location {
	enum OnExit{
		Nothing, Explored
	}

	class Portal : Entity {
		public OnExit type;

		public Portal(double X, double Y, double Width, double Height, OnExit type ) {
			this.X = X;
			this.Y = Y;
			this.Width = Width;
			this.Height = Height;
			this.type = type;
		}

		public override void Draw() {
			GraphicsManager.DrawRectangle(X, Y, Width, Height, Color.BlanchedAlmond);
		}

		public override void Update() {
			if (this.CollidesWith(Location_State.CurrentPlayer)){
				//Leaving the map
				Player player = Location_State.CurrentPlayer;
				Location_State.LeaveLocation();
				if (type == OnExit.Explored) {
					Overworld_State.CurrentRealm.Explore();
				}
			}
		}
	}
}
